<?php
class Advertisement extends Model {
  # property definition
  protected $properties = array(
  	array('name'=>'name', 'required'=>true, 'direct'=>true),
  	array('name'=>'type', 'required'=>true, 'direct'=>true), 
  	array('name'=>'categoryId', 'required'=>true, 'direct'=>true),
  	array('name'=>'email', 'required'=>true, 'direct'=>true),
  	array('name'=>'title', 'required'=>true, 'direct'=>true),
  	array('name'=>'description', 'required'=>true, 'direct'=>true),
  	array('name'=>'townId', 'required'=>true, 'direct'=>true),
  	array('name'=>'id', 'required'=>false, 'direct'=>true),
  	array('name'=>'telephone', 'required'=>false, 'direct'=>true),
  	array('name'=>'price', 'required'=>false, 'direct'=>true),
  	array('name'=>'photo', 'required'=>false, 'direct'=>true),
  	array('name'=>'createdAt', 'required'=>false, 'direct'=>true),
  	array('name'=>'updatedAt', 'required'=>false, 'direct'=>true),
  	array('name'=>'validatedAd', 'required'=>false, 'direct'=>true),
  	array('name'=>'expiredAt', 'required'=>false, 'direct'=>true),
  	
  	# altenative
  	array('name'=>'townName', 'required'=>false, 'direct'=>false),
  	array('name'=>'categoryName', 'required'=>false, 'direct'=>false),
  );
    
  public function __construct($id = '') {
    parent::__construct($id, 'Advertisement', $this->properties);
  }
}